package mqtt

import (
	gomqtt "github.com/eclipse/paho.mqtt.golang"
)

// 获取MQTT连接
func GetClient(opts *gomqtt.ClientOptions) (client gomqtt.Client, err error) {
	client = gomqtt.NewClient(opts)
	if token := client.Connect(); token.Wait() && token.Error() != nil {
		err = token.Error()
	}
	return
}
